package com.ssy.lingxi.order.service.base;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.entity.OrderPurchaseProcessDO;
import com.ssy.lingxi.order.model.vo.process.request.OrderPurchaseProcessContractVO;
import com.ssy.lingxi.order.model.vo.process.response.OrderPurchaseProcessContractQueryVO;

import java.util.List;

/**
 * 采购流程规则关联的合同设置相关接口
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-25
 */
public interface IBaseOrderPurchaseProcessContractService {
    /**
     * 新增、更新采购流程时，校验关联的合同
     * @param purchaseProcesses 已存在的同类型的采购流程规则
     * @param allContracts 是否适用所有合同
     * @param contractList 合同列表
     * @return 操作结果
     */
    Wrapper<Void> checkContracts(List<OrderPurchaseProcessDO> purchaseProcesses, Boolean allContracts, List<OrderPurchaseProcessContractVO> contractList);


    /**
     * 新增采购流程关联的合同，调用方要保存 OrderPurchaseProcessDO
     * @param purchaseProcess 采购流程规则
     * @param allContracts 是否适用所有合同
     * @param contractList 合同列表
     */
    void saveContracts(OrderPurchaseProcessDO purchaseProcess, Boolean allContracts, List<OrderPurchaseProcessContractVO> contractList);

    /**
     * 分页查询采购流程关联的合同列表
     * @param purchaseProcess 采购流程规则
     * @param digest      合同摘要
     * @param current     当前页
     * @param pageSize    每页行数
     * @return 查询结果
     */
    Wrapper<PageData<OrderPurchaseProcessContractQueryVO>> pageContracts(OrderPurchaseProcessDO purchaseProcess, String digest, int current, int pageSize);

    /**
     * 更新采购流程关联的合同，调用方要保存 OrderPurchaseProcessDO
     * @param purchaseProcess 采购流程规则
     * @param allContracts 是否适用所有合同
     * @param contractList 合同列表
     */
    void updateContracts(OrderPurchaseProcessDO purchaseProcess, Boolean allContracts, List<OrderPurchaseProcessContractVO> contractList);
}
